import { reactive, toRefs, getCurrentInstance, h } from "vue"
// ant design
import { message } from "ant-design-vue"
// api
import { borrowlists } from "@/api/index"

export function useBorrowlist() {
    // proxy
    const { proxy } = getCurrentInstance()
    // state
    const state = reactive({
        dataList: [],
    })

    /**
     * 获取列表
     */
    const useGetBookList = (params) => {
        return new Promise((resolve, reject) => {
            borrowlists(params).then(res => {
                state.dataList = res?.content?.data
                resolve(res)
            })
        })
    }


    return {
        ...toRefs(state),
        useGetBookList,
    }
}